__global__ void multiply(double *a, double *b, double *c, int n, int m, int rank,double alpha,double beta) {
	int row = blockIdx.x * blockDim.x + threadIdx.x;
	int col = blockIdx.y * blockDim.y + threadIdx.y;

	int k;
	double sum = 0;
	int times = 0;
	while (times < 10){
		times++;
		if (row < m && col < n) {
			float  *a_t;
			for (k = 0; k < rank; k++) {
				sum += a[row * rank + k] * b[k * n + col];
				a_t[k] = a[row * rank + k];
			}

			/*c[row * n + col] = sum;*/
			double error = c[row * n + col] - sum;
			for (k = 0; k < rank; k++){
				a[row * rank + k] = a[row * rank + k] + alpha * (2*error * b[k * n + col] - beta * a[row * rank + k]);
				b[k * n + col] = b[k * n + col] + alpha * (2*error * a_t[k] - beta * b[k * n + col]);
			}
			//printf("%d\n", c[row * n + col]);
		}
	}
}